﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.HTML
{
    public class HTMLTextAreaElement : HTMLControlBase
    {
        #region Constructors

        internal HTMLTextAreaElement(Document owner)
            : base(owner, "textarea")
        {
        }

        #endregion

        #region DOM Level 2 HTML Compliance

        /// <summary>
        /// Width of control (in characters). See the cols attribute definition 
        /// in HTML 4.01.
        /// </summary>
        public int cols
        {
            get
            {
                return getAttributeAsType<int>("cols", 40);
            }
            set
            {
                setAttributeAsType<int>("cols", value);
            }
        }

        /// <summary>
        /// The number of rows in the textarea.
        /// </summary>
        public int rows
        {
            get
            {
                return getAttributeAsType<int>("rows", 0);
            }
            set
            {
                setAttributeAsType<int>("rows", value);
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public void select()
        {
            focus();
        }

        /// <summary>
        /// The type of this form control. This the string "textarea".
        /// </summary>
        public string type
        {
            get
            {
                return "textarea";
            }
        }

        #endregion
    }
}
